﻿function loadTree() {
    var setting = {
        isSimpleData: true, //数据是否采用简单 Array 格式，默认false
        treeNodeKey: "id", //在isSimpleData格式下，当前节点id属性
        treeNodeParentKey: "pId", //在isSimpleData格式下，当前节点的父节点id属性
        showLine: true//是否显示节点间的连线
    };
    var treeNodes = [
        { "id": 1, "pId": 0, "name": "我的车辆" },
        { "id": 2, "pId": 1, "name": "北斗1" },
        { "id": 3, "pId": 1, "name": "北斗2" },
        { "id": 4, "pId": 1, "name": "北斗3" },
        { "id": 5, "pId": 1, "name": "北斗4" },
        { "id": 6, "pId": 1, "name": "北斗5" },
        { "id": 7, "pId": 1, "name": "北斗6" },
        { "id": 8, "pId": 1, "name": "北斗7" },
        { "id": 9, "pId": 1, "name": "北斗8" },
        { "id": 10, "pId": 2, "name": "北斗11" },
        { "id": 11, "pId": 2, "name": "北斗12" },
        { "id": 12, "pId": 10, "name": "北斗11车辆1" },
        { "id": 13, "pId": 10, "name": "北斗11车辆2" },
        { "id": 14, "pId": 10, "name": "北斗11车辆3" },
        { "id": 15, "pId": 11, "name": "北斗12车辆1" },

        { "id": 16, "pId": 2, "name": "北斗1车辆1" },
        { "id": 17, "pId": 3, "name": "北斗2车辆1" },
        { "id": 18, "pId": 3, "name": "北斗2车辆2" },
        { "id": 19, "pId": 4, "name": "北斗3车辆1" },
        { "id": 20, "pId": 4, "name": "北斗3车辆2" },
        { "id": 21, "pId": 4, "name": "北斗3车辆3" },
        { "id": 22, "pId": 5, "name": "北斗4车辆1" },
        { "id": 23, "pId": 5, "name": "北斗4车辆2" }
    ];

    zTree = $("#tree").zTree(setting, treeNodes);
}